def f(n):
    for i in range(2, n):
        if n % i == 0:
            break
    else:
        return True

t = 0
for i in range(1, 301):
    if f(i):
        print(i, end=' ')
        t = t + 1
        if t % 5 == 0:
            print("\n")
